/*
 * Copyright 2002-2007 the original author or authors.
 *
 * Licensed under the Apache license, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.internna.iwebjtracker.project.model;

import java.util.Collection;

/**
 * A high level component in a Project.
 *
 * @author Jose Noheda
 * @since 1.0
 */
public interface Module<P extends Project<?, C, ?, ?, P>, C extends Module<P, C>> {

    /**
     * Returns the human readable identifier of this module.
     *
     * @return a non empty string
     */
    String getModuleName();

    /**
     * Establishes the module identifier.
     */
    void setModuleName(String name);

    /**
     * Returns the human readable description of this module.
     *
     * @return a non empty string
     */
    String getDescription();

    /**
     * Establishes the module  description.
     */
    void setDescription(String description);

    /**
     * Returns the project this module belongs to.
     */
    P getParentProject();

    /**
     * Establishes the project where this modules hangs.
     */
    void setParentProject(P project);

    /**
     * Returns the module this component belongs to.
     */
    C getParentModule();

    /**
     * Establishes the module where this component hangs.
     */
    void setParentModule(C module);

    /**
     * Returns a group of Modules this project owns.
     *
     * @return a non empty unmodifiable collection
     */
    Collection<C> getComponents();

    /**
     * Adds a new empty module to the group of owned modules.
     *
     * @return the added component
     */
    C addComponent(C component);

    /**
     * Creates a new component with the provided name and description and adds it to this project.
     *
     * @param componentName a non empty string
     * @param componentDescription a non empty string
     * @return the created component
     */
    C createComponent(String componentName, String componentDescription);

}
